package com.server.transaction.service;

import java.util.Objects;

/**
 * @title: SecureInvokeHolder
 * @author: gyuan
 * @description
 * @date: 2023-11-17 16:41
 */
public class SecureInvokeHolder {

    private static final ThreadLocal<Boolean> IS_INVOKE = new ThreadLocal<>();

    public static void setInvoking() {
        IS_INVOKE.set(true);
    }

    public static void invoked() {
        IS_INVOKE.remove();
    }

    public static Boolean isInvoking() {
        return Objects.nonNull(IS_INVOKE.get());
    }

}
